﻿using SocialCee.Configuration;
using SocialCee.Configuration.Contracts;
using SocialCee.ExternalSystems.Common;
using SocialCee.ExternalSystems.Loader;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SocialCee.Framework
{
    /// <summary>
    /// Reads external systems handlers by MEF
    /// </summary>
    public class ExternalSystems
    {
        /// <summary>
        /// Can not modify it during live
        /// </summary>
        public IExternalSystemsFactory SocialMediaClients { get; private set; }
        public bool Init { get; private set; }

        /// <summary>
        /// C-tor
        /// </summary>
        public ExternalSystems()
        {
            Config cfg = Reader.Value;
            ContainerLoad cl = new ContainerLoad(cfg.ExtensionsContainerPath);

            Init = cl.WasInit;
            if (cl.WasInit)
            {
                SocialMediaClients = cl.SocialMediaClients;
            }
        }
    }
}
